import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FeeRecordVO, FeeRecordForm, FeeRecordQuery } from '@/api/nursing/feeRecord/types';

/**
 * 查询费用记录列表
 * @param query
 * @returns {*}
 */

export const listFeeRecord = (query?: FeeRecordQuery): AxiosPromise<FeeRecordVO[]> => {
  return request({
    url: '/nursing/feeRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询费用记录详细
 * @param recordId
 */
export const getFeeRecord = (recordId: string | number): AxiosPromise<FeeRecordVO> => {
  return request({
    url: '/nursing/feeRecord/' + recordId,
    method: 'get'
  });
};

/**
 * 新增费用记录
 * @param data
 */
export const addFeeRecord = (data: FeeRecordForm) => {
  return request({
    url: '/nursing/feeRecord',
    method: 'post',
    data: data
  });
};

/**
 * 修改费用记录
 * @param data
 */
export const updateFeeRecord = (data: FeeRecordForm) => {
  return request({
    url: '/nursing/feeRecord',
    method: 'put',
    data: data
  });
};

/**
 * 删除费用记录
 * @param recordId
 */
export const delFeeRecord = (recordId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/feeRecord/' + recordId,
    method: 'delete'
  });
};
